Rename cli/quick-guide to deploy-app. Add Python example#411
Conversation
WalkthroughAdds a new end-to-end deployment guide for running a Python script on Super Protocol with SPCTL, introduces a sample Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SPCTL
participant CVM as "CVM (container)"
participant CoinGecko as "CoinGecko API"
User->>SPCTL: build & upload artifacts (Docker image, archive)
SPCTL->>CVM: create order & deploy container (entrypoint runs)
CVM->>CVM: entrypoint launches `usd_to_crypto.py`
CVM->>CVM: read `/sp/inputs/input.txt`
CVM->>CoinGecko: HTTP request for BTC/ETH prices
CoinGecko-->>CVM: JSON price response
CVM->>CVM: compute amounts, write `/sp/output/result.txt`
CVM-->>SPCTL: package `/sp/output` as output archive
User->>SPCTL: download output archive (retrieve `result.txt`)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/cli/Guides/tgwui.md (2)
108-177:⚠️ Potential issue | 🟡 MinorBoth TabItems have
defaultattribute.In the Tabs component, both
<TabItem value="tgwui" ...>on line 109 and<TabItem value="comfyui" ...>on line 154 havedefaultset. Only one TabItem should havedefaultto indicate which tab is shown initially. Typically the first one should be the default.Proposed fix
- <TabItem value="comfyui" label="ComfyUI" default> + <TabItem value="comfyui" label="ComfyUI">
190-211:⚠️ Potential issue | 🟡 MinorRemove duplicate
defaultattribute from second TabItem.Similar to the configuration section above, both TabItems have the
defaultattribute. Only one should be marked as default.Proposed fix
- <TabItem value="comfyui" label="ComfyUI" default> + <TabItem value="comfyui" label="ComfyUI">
🤖 Fix all issues with AI agents
In `@docs/cli/Guides/deploy-app/deploy-app-example.md`:
- Line 39: Fix the typo in the documentation line that reads "Create an new file
named `entrypoint.sh`" by changing "an new" to "a new" so the sentence reads
"Create a new file named `entrypoint.sh`"; update the string in
deploy-app-example.md (the sentence containing `entrypoint.sh`) accordingly.
- Line 69: Replace the typo in the sentence "Create an new file named
`Dockerfile`..." by changing "an new" to "a new" so the line reads "Create a new
file named `Dockerfile`..."; update the corresponding text in
deploy-app-example.md where that sentence appears.
In `@docs/cli/Guides/deploy-app/index.md`:
- Line 35: Update the broken relative link string
'/cli/guides/deploy-app/example' in the document (the line containing "Check the
[example](/cli/guides/deploy-app/example) at the end of this guide.") to use the
correct slug '/guides/deploy-app/example' so the example link resolves; replace
the incorrect '/cli/...' path with '/guides/deploy-app/example' wherever that
link appears.
🧹 Nitpick comments (3)
static/files/usd_to_crypto.py (3)
1-2: Remove unused import.The
sysmodule is imported but never used in the script.Proposed fix
import requests -import sys
15-18: Use exception chaining for proper traceback preservation.When re-raising an exception within an
exceptblock, useraise ... from errto preserve the original traceback context.Proposed fix
try: usd_amount = float(content) except ValueError: - raise ValueError("Input is not a valid number") + raise ValueError("Input is not a valid number") from None
26-32: Add defensive checks for API response structure.The code assumes the API response contains
bitcoin.usdandethereum.usdkeys. If the API response structure changes or returns unexpected data, this will raise aKeyError. Consider adding validation or using.get()with appropriate fallback handling.Additionally, while unlikely, a price of 0 from the API would cause a
ZeroDivisionErroron lines 31-32.Proposed fix with defensive checks
data = response.json() - btc_price = data["bitcoin"]["usd"] - eth_price = data["ethereum"]["usd"] + + if "bitcoin" not in data or "usd" not in data.get("bitcoin", {}): + raise RuntimeError("API response missing bitcoin price data") + if "ethereum" not in data or "usd" not in data.get("ethereum", {}): + raise RuntimeError("API response missing ethereum price data") + + btc_price = data["bitcoin"]["usd"] + eth_price = data["ethereum"]["usd"] + + if btc_price <= 0 or eth_price <= 0: + raise RuntimeError("Invalid price data received from API") # Calculate how much BTC and ETH can be bought btc_amount = usd_amount / btc_price eth_amount = usd_amount / eth_price
| ::: | ||
|
|
||
| You can find several Dockerfile examples in the [Super-Protocol/solutions](https://github.com/Super-Protocol/solutions) GitHub repository. | ||
| Check the [example](/cli/guides/deploy-app/example) at the end of this guide. |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find the deploy-app example doc and display its frontmatter (id/slug).
fd -a 'deploy-app-example\.md' docs/cli/Guides/deploy-app -x rg -n --context 3 '^(id|slug):'Repository: Super-Protocol/docs
Length of output: 197
Fix the broken example link path.
The link uses /cli/guides/deploy-app/example, but the file's slug is /guides/deploy-app/example. Remove the /cli prefix to match the correct path.
🤖 Prompt for AI Agents
In `@docs/cli/Guides/deploy-app/index.md` at line 35, Update the broken relative
link string '/cli/guides/deploy-app/example' in the document (the line
containing "Check the [example](/cli/guides/deploy-app/example) at the end of
this guide.") to use the correct slug '/guides/deploy-app/example' so the
example link resolves; replace the incorrect '/cli/...' path with
'/guides/deploy-app/example' wherever that link appears.
Summary by CodeRabbit